import javax.swing.ScrollPaneConstants._
import javax.swing.JScrollPane
import layoutVariety.AlignDirection._
import layoutVariety.ScrollDirection._
import layoutVariety.Box
import scala.swing.ScrollPane
import scala.swing.ScrollPane.BarPolicy

package layoutVariety
{
  //TODO: solve enum issue (AlignDirection and ScrollDirection)
	class OverConstrainedBox(ref : Int) extends Box(ref)
	{
		// init the scroll pane
		protected val pane = new ScrollPane;
		initPane(Both)
		 		
		// set the JPanel inside the scroll pane
		pane.contents=jc
		
		protected def initPane(scrollDir : ScrollDirection)
		{
	  	  	/* set vertical  / Horizontal scrolling */
		  
			if (scrollDir == Horizontal)
			{
				pane.horizontalScrollBarPolicy = BarPolicy.AsNeeded 
				pane.verticalScrollBarPolicy = BarPolicy.Never
			}
			else if (scrollDir == ScrollDirection.Vertical)
			{
				pane.horizontalScrollBarPolicy = BarPolicy.Never 
				pane.verticalScrollBarPolicy = BarPolicy.AsNeeded
			}
			else // scrollDir == ScrollDirection.Both
			{
				pane.horizontalScrollBarPolicy = BarPolicy.AsNeeded 
				pane.verticalScrollBarPolicy = BarPolicy.AsNeeded
			}
		}
		override def getWidget() = pane;
		def setScrollDirection(scrollDir : ScrollDirection)
		{
		  initPane(scrollDir);
		}
		
		
		
	}
}